import { AppDataSource } from '@/data-source';
import {
  User,
  Symptom,
  DailyHealth,
  InternalHealth,
  RelationShip,
  ModuleClick,
} from '@/entity/miniProgram/User';
import { Data } from '@/entity/Data';
import {
  DrugReminder,
  DrugKnowledge,
} from '@/entity/miniProgram/Drug';
import { CapacityDiary } from '@/entity/miniProgram/CapacityDiary';
import { KnowledgeClassroom } from '@/entity/miniProgram/KnowledgeClassroom';
import { Repository } from 'typeorm';
import { Role } from '@/entity/miniProgram/Role';
import { Consultation } from '@/entity/Consultation';

class BaseController {
  protected userRepository: Repository<User>;
  protected roleRepository: Repository<Role>;
  protected symptomRepository: Repository<Symptom>;
  protected moduleClickRepository: Repository<ModuleClick>;
  protected dailyHealthRepository: Repository<DailyHealth>;
  protected internalHealthRepository: Repository<InternalHealth>;
  protected relationShipRepository: Repository<RelationShip>;
  protected drugReminderRepository: Repository<DrugReminder>;
  protected drugKnowledgeRepository: Repository<DrugKnowledge>;
  protected capacityDiaryRepository: Repository<CapacityDiary>;
  protected knowledgeClassroomRepository: Repository<KnowledgeClassroom>;
  protected consultationRepository: Repository<Consultation>;
  protected dataRepository: Repository<Data>;
  constructor() {
    this.userRepository = AppDataSource.getRepository(User);
    this.roleRepository = AppDataSource.getRepository(Role);
    this.symptomRepository = AppDataSource.getRepository(Symptom);
    this.moduleClickRepository =
      AppDataSource.getRepository(ModuleClick);
    this.dailyHealthRepository =
      AppDataSource.getRepository(DailyHealth);
    this.internalHealthRepository =
      AppDataSource.getRepository(InternalHealth);
    this.relationShipRepository =
      AppDataSource.getRepository(RelationShip);
    this.drugReminderRepository =
      AppDataSource.getRepository(DrugReminder);
    this.drugKnowledgeRepository =
      AppDataSource.getRepository(DrugKnowledge);
    this.capacityDiaryRepository =
      AppDataSource.getRepository(CapacityDiary);
    this.knowledgeClassroomRepository = AppDataSource.getRepository(
      KnowledgeClassroom
    );
    this.consultationRepository =
      AppDataSource.getRepository(Consultation);
    this.dataRepository = AppDataSource.getRepository(Data);
  }
}

export default BaseController;
